<?php defined('InShopNC') or exit('Access Invalid!');?>
<link rel="stylesheet" type="text/css" href="<?php echo RESOURCE_SITE_URL;?>/js/jquery-ui/themes/ui-lightness/jquery.ui.css"  />
<div class="eject_con">
  <div id="warning" class="alert alert-error"></div>
  <form method="post" target="_parent" action="index.php?act=store_activity&op=activity_add"enctype="multipart/form-data" id="brand_apply_form">
    <input type="hidden" name="form_submit" value="ok" />
    <input type="hidden" name="brand_id" value="<?php echo $output['brand_array']['brand_id']; ?>" />
    <dl>
      <dt><i class="required">*</i>活动标题<?php echo $lang['nc_colon'];?></dt>
      <dd>
        <input type="text" id="activity_title" name="activity_title" class="input-txt" >
        <p class="hint">金福银贵专场活动</p>
      </dd>
    </dl>
    <dl>
      <dt><i class="required">*</i>开始时间<?php echo $lang['nc_colon'];?></dt>
      <dd>
        <input type="text" id="start_time" name="activity_start_date" class="input-txt" />
      </dd>
    </dl>
    <dl>
      <dt><i class="required">*</i>结束时间<?php echo $lang['nc_colon'];?></dt>
      <dd>
        <input type="text" id="end_time" name="activity_end_date" class="input-txt" />
      </dd>
    </dl>
    <dl>
      <dt><i class="required">*</i>活动图片<?php echo $lang['nc_colon'];?></dt>
      <dd>
        <div class="ncsc-goods-default-pic">
          <input type="file"  name="activity_banner" id="goods_image" nc_type="logo">
          <img src="<?php echo UPLOAD_SITE_URL . DS . ATTACH_COMMON . DS."default_goods_image.gif";?>" nc_type="logo1" />
          <p class="hint">建议上传大小为375x210的图片</p>
        </div>
      </dd>
    </dl>

    <div class="bottom">
      <label class="submit-border"><input type="submit" class="submit" value="<?php echo $lang['nc_submit'];?>"/></label>
    </div>
  </form>
</div>
<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/js/common.js" charset="utf-8"></script>
<script src="<?php echo RESOURCE_SITE_URL;?>/js/jquery-ui/i18n/zh-CN.js"></script>
<script src="<?php echo RESOURCE_SITE_URL;?>/js/jquery-ui-timepicker-addon/jquery-ui-timepicker-addon.min.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo RESOURCE_SITE_URL;?>/js/jquery-ui-timepicker-addon/jquery-ui-timepicker-addon.min.css"  />

<script type="text/javascript">

  $(function(){
    $('#start_time').datetimepicker({
      controlType: 'select'
    });
    $('#end_time').datetimepicker({
      controlType: 'select'
    });

    jQuery.validator.addMethod("initial", function(value, element) {
      return /^[A-Za-z0-9]$/i.test(value);
    }, "");
    $('#brand_apply_form').validate({
      errorLabelContainer: $('#warning'),
      invalidHandler: function(form, validator) {
        $('#warning').show();
      },
      submitHandler:function(form){
        //$("#brand_apply_form").submit();
        ajaxpost('brand_apply_form', '', '', 'onerror')
      },
      rules : {
        brand_name : {
          required : true,
          rangelength: [0,100]
        },
        brand_initial : {
          initial  : true
        }
        <?php if ($output['brand_array']['brand_id']=='') { ?>
        ,
        brand_pic : {
          required : true
        }
        <?php } ?>
      },
      messages : {
        brand_name : {
          required : '<i class="icon-exclamation-sign"></i><?php echo $lang['store_goods_brand_input_name'];?>',
          rangelength: '<i class="icon-exclamation-sign"></i><?php echo $lang['store_goods_brand_name_error'];?>'
        },
        brand_initial : {
          initial : '<i class="icon-exclamation-sign"></i>请填写正确首字母'
        }
        <?php if ($output['brand_array']['brand_id']=='') { ?>
        ,
        brand_pic : {
          required : '<i class="icon-exclamation-sign"></i><?php echo $lang['store_goods_brand_icon_null'];?>'
        }
        <?php } ?>
      }
    });
    $('input[nc_type="logo"]').change(function(){
      var src = getFullPath($(this)[0]);
      $('img[nc_type="logo1"]').attr('src', src);
    });
  });

</script>
